package initialize

import (
	"github.com/openai/openai-go"
	"github.com/openai/openai-go/option"
	"github.com/smash-llj/Nexa-server/global"
	"github.com/spf13/viper"
)

func InitOpenAi() *openai.Client {
	key := viper.GetString("AI.ApiKey")
	baseUrl := viper.GetString("AI.BaseUrl")
	client := openai.NewClient(
		option.WithAPIKey(key),
		option.WithBaseURL(baseUrl),
	)
	global.AiClient = &client
	return global.AiClient
}
